'''
 * @ author     ：廖传港
 * @ date       ：Created in 2020/12/4 18:11
 * @ description：
 * @ modified By：
 * @ ersion     : 
 * @File        : test2.py 
'''
"""
加载已经持久化的模型
"""
# from sklearn.externals import joblib
import pickle
import joblib

model = joblib.load("D:/python/data/model2.pkl")  # 加载模型

X_test = [[8], [9], [11], [16], [12]]
Y_test = [[11], [8.5], [15], [18], [11]]

Y_test_predict = model.predict(X_test)
for i, prediction in enumerate(Y_test_predict):
    print("预测值: %s, 实际值: %s" % (prediction, Y_test[i]))

print("model score=", model.score(X_test, Y_test))